API

GenFarmer API Documentation

Welcome to the GenFarmer API documentation. This guide helps you understand how to interact with the GenFarmer automation system via RESTful APIs.


🧠 Overview

GenFarmer provides endpoints to manage Automation Apps, Tasks, and Runs that can be assigned to devices for automation scenarios.


πŸ“¦ Base URL

http://127.0.0.1:55554/

πŸ“ Automation APIs

πŸ” List Apps

  • Method: GET

  • Endpoint: /automation/apps

cURL Example:

curl -X GET 'http://127.0.0.1:55554/automation/apps?userId=3&page=1&limit=25&order=desc&orderBy=updatedAt'

πŸ” Get App Details

  • Method: GET

  • Endpoint: /automation/apps/:id

cURL Example:

curl -X GET 'http://127.0.0.1:55554/automation/apps/adoFNVNN6Jwl8FlbZCfni'

πŸ”§ Update App

  • Method: PUT

  • Endpoint: /automation/apps

cURL Example:

curl -X PUT 'http://127.0.0.1:55554/automation/apps' \
  -H 'Content-Type: application/json' \
  -d '{"id":"adoFNVNN6Jwl8FlbZCfni","userId":3,"name":"New App","description":"","version":"1.0.0","script":{"flow":{"nodes":[],"edges":[]}}}'

❌ Delete App

  • Method: DELETE

  • Endpoint: /automation/apps

cURL Example:

curl -X DELETE 'http://127.0.0.1:55554/automation/apps' \
  -H 'Content-Type: application/json' \
  -d '{"ids": ["2ykTiCbEOAYC_5_tR5Wp-"]}'

🧾 Task APIs

βž• Create Task

  • Method: POST

  • Endpoint: /automation/tasks

cURL Example:

curl -X POST 'http://127.0.0.1:55554/automation/tasks' \
  -H 'Content-Type: application/json' \
  -d '{"appId":"adoFNVNN6Jwl8FlbZCfni","input":[],"userId":3,"name":"test","devices":{"enable":true,"list":[]}}'

πŸ“„ List Tasks

  • Method: GET

  • Endpoint: /automation/runs

cURL Example:

curl -X GET 'http://127.0.0.1:55554/automation/runs?userId=3&page=1&limit=25&order=desc&orderBy=createdAt'

πŸ›  Update Task

  • Method: PUT

  • Endpoint: /automation/tasks/:id

cURL Example:

curl -X PUT 'http://127.0.0.1:55554/automation/tasks/uNDVKT_VwhEDuXT3PGUUv' \
  -H 'Content-Type: application/json' \
  -d '{"id":"uNDVKT_VwhEDuXT3PGUUv","userId":3,"appId":"adoFNVNN6Jwl8FlbZCfni","taskSource":0,"name":"test","input":[],"enableInput":true,"devices":{"enable":true,"list":[{"id":"emulator-5554","serialNo":"00f65a5d","name":"SM-G960N"}]}}'

πŸ”— Assign Devices to Task

  • Method: PUT

  • Endpoint: /automation/tasks/:id/add-devices

cURL Example:

curl -X PUT 'http://127.0.0.1:55554/automation/tasks/uNDVKT_VwhEDuXT3PGUUv/add-devices' \
  -H 'Content-Type: application/json' \
  -d '{"devices":{"enabled":true,"list":[{"id":"emulator-5554","serialNo":"00f65a5d","name":"SM-G960N"}]}}'

πŸ”— Remove Devices from Task

  • Method: PUT

  • Endpoint: /automation/tasks/:id/remove-devices

πŸ—‘ Delete Task

  • Method: DELETE

  • Endpoint: /automation/tasks

cURL Example:

curl -X DELETE 'http://127.0.0.1:55554/automation/tasks' \
  -H 'Content-Type: application/json' \
  -d '{"ids": ["uNDVKT_VwhEDuXT3PGUUv"]}'

πŸš€ Run APIs

▢️ Create Run

  • Method: POST

  • Endpoint: /automation/runs

cURL Example:

curl -X POST 'http://127.0.0.1:55554/automation/runs' \
  -H 'Content-Type: application/json' \
  -d '{"userId":3,"taskId":"uNDVKT_VwhEDuXT3PGUUv","appId":"adoFNVNN6Jwl8FlbZCfni","status":0}'

▢️ Execute Run

  • Method: PUT

  • Endpoint: /automation/runs/:id/run

cURL Example:

curl -X PUT 'http://127.0.0.1:55554/automation/runs/xhfjAeUOB5SXC8d5RiK_c/run' \
  -H 'Content-Type: application/json' \
  -d '{"deviceIds":[]}'

πŸ“Š Get Run Output

  • Method: GET

  • Endpoint: /automation/runs/:id/storages

cURL Example:

curl -X GET 'http://127.0.0.1:55554/automation/runs/xhfjAeUOB5SXC8d5RiK_c/storages?page=1&limit=25'

πŸ‘€ Me API

πŸ™‹β€β™‚οΈ Get Current User

  • Method: GET

  • Endpoint: /backend/auth/me

cURL Example:

curl -X GET 'http://127.0.0.1:55554/backend/auth/me'

πŸ“˜ Notes

  • Replace all :id placeholders with the actual id of your app, task, or run.

  • The script.flow field in Update App allows defining an automation logic visually using nodes and edges.


πŸ“₯ Download Postman Collection

πŸ“ž Support

For further help, please contact the GenFarmer support team.

Last updated